#include "mainmenustate.h"

#include <gui/paintscene.h>
#include <gui/mainmenuscene.h>
#include <game/keymanager.h>
#include <gui/statemanager.h>
#include <gui/gamestate.h>

MainMenuState::MainMenuState(StateManager *stateManager, KeyManager *keyManager, QObject *parent) :
    State(parent)
{
    myKeyManager = keyManager;
    myStateManager = stateManager;

    myScene = new MainMenuScene(this);

    myKeyManager->addPressEvent(Qt::Key_Up, myScene, SLOT(up()));
    myKeyManager->addPressEvent(Qt::Key_Down, myScene, SLOT(down()));
    myKeyManager->addPressEvent(Qt::Key_Return, myScene, SLOT(enter()));

    connect(myScene, SIGNAL(updated()), this, SIGNAL(updated()));

    connect(myScene, SIGNAL(enterExit()), this, SLOT(exit()));
    connect(myScene, SIGNAL(enterSingle()), this, SLOT(sinlge()));
    connect(myScene, SIGNAL(enterMulti()), this, SLOT(multi()));
}

PaintScene *MainMenuState::getScene() const {
    return myScene;
}

void MainMenuState::added() {

}

void MainMenuState::deleted() {

}

void MainMenuState::covered() {

}

void MainMenuState::returned() {
    emit updated();
}

void MainMenuState::exit() {

}

void MainMenuState::sinlge() {

}

void MainMenuState::multi() {
    GameState *state = new GameState(myStateManager, myKeyManager, this);
    myStateManager->pushState(state);
}
